import SubPage from "@/components/subui/SubPage.vue";
import AnalysePage from "@components/subui/dashboard/AnalysePage.vue";
import WorkBench from "@components/subui/dashboard/WorkBench.vue";
import ProfilePage from "@/components/subui/profiles/ProfilePage.vue";
import StaffManagement from '@/components/subui/management/StaffManagement.vue';
import DepartmentManagement from '@/components/subui/management/DepartmentManagement.vue';
import PostPage from '@components/subui/dzone/PostPage.vue';
import Post from '@components/subui/dzone/Post.vue';
import Article from '@components/subui/dzone/Article.vue';
import ArticlePage from '@components/subui/dzone/ArticlePage.vue';
import WriteArticle from '@components/subui/dzone/WriteArticle.vue';
import NotImplementYet from "@components/subui/NotImplementYet.vue";
import { DashboardOutlined, MobileOutlined, ProfileOutlined, RadarChartOutlined, SmileOutlined, UserOutlined } from "@ant-design/icons-vue";
import useDefault from '@composable/defaults';

const { defaultPost, defaultArticle } = useDefault();

export default [
  {
    path: "/main/dashboard",
    name: "routes.dashboard",
    redirect: "/main/dashboard/analyse",
    component: SubPage,
    icon: DashboardOutlined,
    children: [
      {
        path: "/main/dashboard/analyse",
        name: "routes.analyse",
        component: AnalysePage,
      },
      {
        path: "/main/dashboard/workbench",
        name: "routes.workbench",
        component: WorkBench,
      },
    ],
  },{
    path: "/main/managment",
    name: "系统管理",
    redirect: "/main/management/staffmanage",
    component: SubPage,
    icon: RadarChartOutlined,
    children: [
      {
        path: "/main/management/staffmanage",
        name: "职工管理",
        component: StaffManagement,
      },
      {
        path: "/main/management/departmentmanage",
        name: "部门管理",
        component: DepartmentManagement,
      },
    ],
  },{
    path: "/main/dzone",
    name: "DZone",
    redirect: "/main/dzone/posts",
    component: SubPage,
    icon: SmileOutlined,
    children: [
      {
        path: "/main/dzone/posts",
        name: "动态",
        component: PostPage,
      },
      {
        path: "/main/dzone/articles",
        name: "文章",
        component: ArticlePage,
      },
      {
        path: "/main/dzone/repos",
        name: "Repos",
        component: NotImplementYet,
      }, {
        path: "/main/dzone/lookpost",
        name: "lookpost",
        props: route => {
          return { post: route.params && route.params.post ? JSON.parse(route.params.post) : defaultPost }
        },
        component: Post
      },{
        path: "/main/dzone/lookarticle",
        name: "lookarticle",
        props: route => {
          return { article: route.params && route.params.article ? JSON.parse(route.params.article) : defaultArticle }
        },
        component: Article
      },{
        path: "/main/dzone/newarticle",
        name: "newarticle",
        component: WriteArticle
      }
    ],
  },{
    path: "/main/docs",
    name: "外部页面",
    redirect: "/main/docs/project-doc",
    component: SubPage,
    icon: MobileOutlined,
    children: [
      {
        path: "/main/docs/project-doc",
        name: "项目文档(内嵌)",
        component: NotImplementYet,
      },
      {
        path: "/main/docs/antvue-doc",
        name: "antVue文档(内嵌)",
        component: NotImplementYet,
      },
      {
        path: "/main/docs/project-doc-outlink",
        name: "项目文档(外链)",
        component: NotImplementYet,
      }
    ],
  },{
    path: "/main/me",
    name: "我的",
    redirect: "/main/me/profile",
    component: SubPage,
    icon: UserOutlined,
    children: [
      {
        path: "/main/me/profile",
        name: "个人资料",
        component: ProfilePage
      }
    ]
  },
];
